var app = getApp()

Page({
  data:{
    userInfo : {"nickName":"未登陆", "avatarUrl": "http://img.bitscn.com/upimg/allimg/c160120/1453262K454E0-33030.jpg"},
    isLogin : false,
    actions : [
      {"index":0,"name":"我参加的活动","icon":"/imgs/icon_my_activity.png"},
      {"index":1,"name":"关于我们","icon":"/imgs/icon_aboutus.png"}]
  },

  userclick:function(){
    if(!this.data.isLogin){
      //没有登录
      wx.showModal({
        title: '登录提示',
        content: '请退出或删除小程序后重新进入，点击【允许】授权即可'
      })
    }
  },

  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数]
    if(app.globalData.isLogin){
      this.setData({
        isLogin : app.globalData.isLogin,
        userInfo : app.globalData.userInfo
      });
    }

    console.log(this.data.userInfo);
    if(this.data.isLogin){
      //已登录
      
    }
  },

  onActionClick : function(event){
    var index = event.currentTarget.dataset.index;
    if(index == 0){//我参加的活动
      wx.navigateTo({
          url: '../activitylist/activitylist'
      })
    }else if(index == 1){
      wx.navigateTo({
          url: '../aboutus/aboutus'
      })
    }
  }
})